<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #eCharts {
        width: 800px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div id="eCharts"></div>
    <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.1.2/echarts.min.js"></script>
    <script>
      const chartDom = document.getElementById('eCharts')
      // 初始化
      const myECharts = echarts.init(chartDom)
      myECharts.setOption({
        title: {
          text: '柱状图',
          subText: '副标题'
        },
        xAxis: {
          type: 'category',
          data: ['手机', '母婴', '食品', '女装']
        },
        yAxis: {
         axisPointer:{
          show:true,
         },
         axisLine:{
          show:true//显示y轴线
         }
        },
        // 系列
        series: {
         // bar 柱状图
          type: 'bar',
          data: [20, 50, 60, 80]
        },
        color:['pink','skyblue','hotpink','yellowgreen']
      })
    </script>
  </body>
</html>
